Rmove continue button, fix bug with facebook signup.

This commit is contained in:
gaba
2017-02-23 09:48:59 -08:00
parent 32bc754bf7
commit 5d0ea6a880
5 changed files with 14 additions and 24 deletions
@@ -50,7 +50,6 @@ const CreateUsernameDialog = ({open, handleClose, offset, formData, handleSubmit
/>
<Button id="save" type="submit" className={styles.saveButton}>{lang.t('createdisplay.save')}</Button>
</div>
<Button className={styles.continuebutton} onClick={handleClose}>{lang.t('createdisplay.continue')}</Button>
</form>
</div>
</div>
@@ -173,13 +173,6 @@ input.error{
color: white;
}
.continuebutton {
background-color: black;
font-weight: bold;
color: white;
min-width: 200px;
}
.fakeComment {
display: block;
margin-bottom: 5px;
@@ -104,7 +104,7 @@ class ChangeUsernameContainer extends Component {
return (
<div>
<CreateUsernameDialog
open={auth.showCreateUsernameDialog && auth.fromSignUp}
open={auth.showCreateUsernameDialog && auth.user.canEditName}
offset={offset}
handleClose={this.handleClose}
loggedIn={loggedIn}
+9 -14
View File
@@ -2,7 +2,6 @@ const express = require('express');
const passport = require('../../../services/passport');
const authorization = require('../../../middleware/authorization');
const errors = require('../../../errors');
const UsersService = require('../../../services/users');
const router = express.Router();
@@ -61,6 +60,7 @@ const HandleAuthCallback = (req, res, next) => (err, user) => {
/**
* Returns the response to the login attempt via a popup callback with some JS.
*/
const HandleAuthPopupCallback = (req, res, next) => (err, user) => {
if (err) {
return res.render('auth-callback', {err: JSON.stringify(err), data: null});
@@ -70,20 +70,15 @@ const HandleAuthPopupCallback = (req, res, next) => (err, user) => {
return res.render('auth-callback', {err: JSON.stringify(errors.ErrNotAuthorized), data: null});
}
// Authorize the user to edit their username.
UsersService.toggleNameEdit(user.id, true)
.then(() => {
// Perform the login of the user!
req.logIn(user, (err) => {
if (err) {
return res.render('auth-callback', {err: JSON.stringify(err), data: null});
}
// Perform the login of the user!
req.logIn(user, (err) => {
if (err) {
return res.render('auth-callback', {err: JSON.stringify(err), data: null});
}
// We logged in the user! Let's send back the user data.
res.render('auth-callback', {err: null, data: JSON.stringify(user)});
});
});
// We logged in the user! Let's send back the user data.
res.render('auth-callback', {err: null, data: JSON.stringify(user), changeusername: true});
});
};
/**
+4 -1
View File
@@ -124,6 +124,8 @@ module.exports = class UsersService {
return user;
}
// User does not exist and need to be created.
let username = UsersService.castUsername(displayName);
// The user was not found, lets create them!
@@ -131,7 +133,8 @@ module.exports = class UsersService {
username,
lowercaseUsername: username.toLowerCase(),
roles: [],
profiles: [{id, provider}]
profiles: [{id, provider}],
canEditName: true
});
return user.save();