AuthActions.authenticate({ username: submission.formData.username, password: submission.formData.password, }) .then(() => { this.setState({isSubmitting: false}, () => history.replace('overview')); }) .catch(() => { this.setState({isSubmitting: false}, () => history.replace('login')); });
handleSubmit(event) { event.preventDefault(); event.stopPropagation(); Actions.login({ username: this.input.username.value(), password: this.input.password.value() }); }
const mapStateToProps = (state) => { return { username: state.user.user.username, settings: state.settings.settings } }
handleLoginSuccess(data) { this.currentUser.username = data.username; this.currentUser.isAdmin = data.isAdmin; this.currentUser.isInitialUser = false; this.token = data.token; this.isAuthenticating = true; this.isAuthenticated = true; this.emit(EventTypes.AUTH_LOGIN_SUCCESS); }
this.config.database.find('_User', { objectId: this.objectId() }).then(results => { if (results.length != 1) { throw undefined; } if (this.data.password.indexOf(results[0].username) >= 0) return Promise.reject(new Parse.Error(Parse.Error.VALIDATION_ERROR, containsUsernameError)); return Promise.resolve(); })
this.props.signin(this.state.username, this.state.password, { ...this.updateCallbacks, onNewPasswordRequested: (callback) => { this.setState({ isUpdating: false, message: '', password: '', dialogType: dialogType.setNewPassword, newPasswordCallback: callback }) } })
// basic json response test("Basic JSON Response", () => { return get("/python/basic", { json: true }).then(data => { expect(data.username).toBe("basic"); }); });
/** * set _failed_login_count to value */ _setFailedLoginCount(value) { const query = { username: this._user.username, }; const updateFields = { _failed_login_count: value, }; return this._config.database.update('_User', query, updateFields); }
/** * Regenerates the given user's email verification token * * @param user * @returns {*} */ regenerateEmailVerifyToken(user) { this.setEmailVerifyToken(user); return this.config.database.update('_User', { username: user.username }, user); }
// Returns the user's desired display name async function getDisplayName() { let user = settings.username || null; if (user) return user; try { user = await require("username")(); } catch (e) {} return user; }
this.props.setCodeAndPassword(this.state.code, this.state.username, this.state.password, { ...this.updateCallbacks, onSuccess: () => { this.setState({ isUpdating: false, message: 'Set new password successfully!', dialogType: dialogType.signin, password: '' }) } })
const mapStateToProps = (state) => { return { username: state.user.user.username, settings: state.settings.settings } }