@ -510,11 +510,9 @@ func SignUpPost(ctx *context.Context) {
Name : form . UserName ,
Name : form . UserName ,
Email : form . Email ,
Email : form . Email ,
Passwd : form . Password ,
Passwd : form . Password ,
IsActive : ! ( setting . Service . RegisterEmailConfirm || setting . Service . RegisterManualConfirm ) ,
IsRestricted : setting . Service . DefaultUserIsRestricted ,
}
}
if ! createAndHandleCreatedUser ( ctx , tplSignUp , form , u , nil , false ) {
if ! createAndHandleCreatedUser ( ctx , tplSignUp , form , u , nil , nil , false ) {
// error already handled
// error already handled
return
return
}
}
@ -525,8 +523,8 @@ func SignUpPost(ctx *context.Context) {
// createAndHandleCreatedUser calls createUserInContext and
// createAndHandleCreatedUser calls createUserInContext and
// then handleUserCreated.
// then handleUserCreated.
func createAndHandleCreatedUser ( ctx * context . Context , tpl base . TplName , form interface { } , u * user_model . User , gothUser * goth . User , allowLink bool ) bool {
func createAndHandleCreatedUser ( ctx * context . Context , tpl base . TplName , form interface { } , u * user_model . User , overwrites * user_model . CreateUserOverwriteOptions , gothUser * goth . User , allowLink bool ) bool {
if ! createUserInContext ( ctx , tpl , form , u , gothUser , allowLink ) {
if ! createUserInContext ( ctx , tpl , form , u , overwrites , gothUser , allowLink ) {
return false
return false
}
}
return handleUserCreated ( ctx , u , gothUser )
return handleUserCreated ( ctx , u , gothUser )
@ -534,8 +532,8 @@ func createAndHandleCreatedUser(ctx *context.Context, tpl base.TplName, form int
// createUserInContext creates a user and handles errors within a given context.
// createUserInContext creates a user and handles errors within a given context.
// Optionally a template can be specified.
// Optionally a template can be specified.
func createUserInContext ( ctx * context . Context , tpl base . TplName , form interface { } , u * user_model . User , gothUser * goth . User , allowLink bool ) ( ok bool ) {
func createUserInContext ( ctx * context . Context , tpl base . TplName , form interface { } , u * user_model . User , overwrites * user_model . CreateUserOverwriteOptions , gothUser * goth . User , allowLink bool ) ( ok bool ) {
if err := user_model . CreateUser ( u ) ; err != nil {
if err := user_model . CreateUser ( u , overwrites ) ; err != nil {
if allowLink && ( user_model . IsErrUserAlreadyExist ( err ) || user_model . IsErrEmailAlreadyUsed ( err ) ) {
if allowLink && ( user_model . IsErrUserAlreadyExist ( err ) || user_model . IsErrEmailAlreadyUsed ( err ) ) {
if setting . OAuth2Client . AccountLinking == setting . OAuth2AccountLinkingAuto {
if setting . OAuth2Client . AccountLinking == setting . OAuth2AccountLinkingAuto {
var user * user_model . User
var user * user_model . User