diff --git a/app/assets/stylesheets/devise/registrations/edit.sass b/app/assets/stylesheets/auth_users/edit.sass
similarity index 89%
rename from app/assets/stylesheets/devise/registrations/edit.sass
rename to app/assets/stylesheets/auth_users/edit.sass
index 4d22860f..68e86ec7 100644
--- a/app/assets/stylesheets/devise/registrations/edit.sass
+++ b/app/assets/stylesheets/auth_users/edit.sass
@@ -1,6 +1,6 @@
-@import "../../partials/clean/constants"
+@import "../partials/clean/constants"
-body.devise-registrations-edit, body.devise-registrations-update
+body.auth_users-edit, body.auth_users-update
.settings-form
border: 1px solid $module-border-color
background: $module-bg-color
diff --git a/app/controllers/auth_users_controller.rb b/app/controllers/auth_users_controller.rb
new file mode 100644
index 00000000..befa40d3
--- /dev/null
+++ b/app/controllers/auth_users_controller.rb
@@ -0,0 +1,50 @@
+class AuthUsersController < ApplicationController
+ before_action :authenticate_user!, except: [:new, :create]
+
+ def create
+ @auth_user = AuthUser.create(auth_user_params)
+
+ if @auth_user.persisted?
+ sign_in :auth_user, @auth_user
+ flash[:notice] = "Welcome to Dress to Impress, #{@auth_user.name}! 💖"
+ redirect_to root_path
+ else
+ render action: :new, status: :unprocessable_entity
+ end
+ end
+
+ def edit
+ @auth_user = current_auth_user
+ end
+
+ def new
+ @auth_user = AuthUser.new
+ end
+
+ def update
+ @auth_user = load_auth_user
+
+ if @auth_user.update_with_password(auth_user_params)
+ flash[:notice] = "Settings successfully saved."
+ redirect_to action: :edit
+ else
+ render action: :edit, status: :unprocessable_entity
+ end
+ end
+
+ private
+
+ def auth_user_params
+ params.require(:auth_user).permit(:name, :email, :password,
+ :password_confirmation, :current_password)
+ end
+
+ def load_auth_user
+ # Well, what we *actually* do is just use `current_auth_user`, and enforce
+ # that the provided user ID matches. The user ID param is only really for
+ # REST semantics and such!
+ raise AccessDenied unless auth_user_signed_in?
+ raise AccessDenied unless current_auth_user.id == params[:id].to_i
+ current_auth_user
+ end
+end
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/auth_users/edit.html.erb
similarity index 78%
rename from app/views/devise/registrations/edit.html.erb
rename to app/views/auth_users/edit.html.erb
index 68857d5f..a7eec3ec 100644
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/auth_users/edit.html.erb
@@ -1,8 +1,8 @@
Settings
-<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: "settings-form" }) do |f| %>
+<%= form_with(model: @auth_user, method: :put, class: "settings-form") do |f| %>
Your info
- <%= render "devise/shared/error_messages", resource: resource %>
+ <%= render "devise/shared/error_messages", resource: @auth_user %>