Sha256: 588d730a877f76921e55d6660244a5c791d897f70520b81a35976cac5d95aa49
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
class UsersController < ApplicationController before_action :require_login, only: [:edit, :update] def edit @user = current_user end def update @user = current_user orig_confirmation_email = @user.confirmation_email if @user.update_attributes(user_params) # Send a new email confirmation if the user updated their email address if @user.confirmation_email.present? && @user.confirmation_email != @user.email && @user.confirmation_email != orig_confirmation_email @user.send_confirmation end respond_to do |format| format.json { head :no_content } format.html { redirect_to account_path } end else respond_to do |format| format.json { render json: { status: 'error', errors: @user.errors }.to_json, status: 422 } format.html { render :edit } end end end protected def user_params params.require(:user).permit( :confirmation_email, <% if username? %>:username, <% end %>:password, :password_confirmation, :first_name, :last_name, :bio, :website, :phone_number, :time_zone) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authkit-0.7.0 | lib/generators/authkit/templates/app/controllers/users_controller.rb |