mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
parent
4d2f25ab20
commit
c838272622
2 changed files with 18 additions and 2 deletions
|
|
@ -99,13 +99,14 @@ class UsersController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
signup_by_admin = true if (@user && @user.is_admin?)
|
||||
first_user_signing_up = User.no_users_yet?
|
||||
user.is_admin = true if first_user_signing_up
|
||||
if user.save
|
||||
@user = User.authenticate(user.login, params['user']['password'])
|
||||
@user.create_preference({:locale => I18n.locale})
|
||||
@user.save
|
||||
session['user_id'] = @user.id if first_user_signing_up
|
||||
session['user_id'] = @user.id unless signup_by_admin
|
||||
notify :notice, t('users.signup_successful', :username => @user.login)
|
||||
redirect_back_or_home
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue