This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
## マイページ | |
# get 'mypage', to: 'users#index ' | |
## ユーザ | |
get 'mypage', to: 'users#show' | |
get '/users/new', to: 'users#new' | |
post '/users/create', to: 'users#create' | |
delete '/users/unsubscribe', to: 'usesrs#destroy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h2 ログイン | |
= form_for :session ,url: login_path do |f| | |
.field | |
= f.text_field :mailaddr,class:"input",type:"email" | |
.field | |
= f.password_field :password,class:"input" | |
= f.submit 'ログイン',class: "button is-success" | |
= link_to 'アカウントを持っていない方は->新規登録', users_new_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= form_for @user,url: users_create_url do |f| | |
- if @user.errors.any? | |
#error_explanation | |
h2 = "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:" | |
ul | |
- @user.errors.full_messages.each do |message| | |
li = message | |
.field | |
= f.label :name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_action :current_user | |
before_action :require_sign_in! | |
helper_method :signed_in? | |
protect_from_forgery with: :exception | |
def current_user | |
remember_token = User.encrypt(cookies[:user_remember_token]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < ApplicationController | |
def new | |
end | |
def create | |
if @user.authenticate(session_params[:password]) | |
sign_in(@user) | |
redirect_to mypage_url | |
else | |
flash.now[:danger] = t('.flash.invalid_password') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
# サインアップ | |
def new | |
@user = User.new | |
end | |
## 新規登録 | |
def create | |
@user = User.new(user_params) | |
if @user.save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ApplicationRecord | |
has_secure_password validations: true | |
validates :mailaddr, presence: true, uniqueness: true | |
def self.new_remember_token | |
SecureRandom.urlsafe_base64 | |
end | |
def self.encrypt(token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer require laravelcollective/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The server could not connect to the client to verify the domain :: Failed to connect to host for DVSNI challenge, <your-domain-name> (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Failed to connect to host for DVSNI challenge | |
IMPORTANT NOTES: | |
- The following errors were reported by the server: | |
Domain: <your-domain-name> | |
Type: urn:acme:error:connection | |
Detail: Failed to connect to host for DVSNI challenge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php artisan make:migration create_articles_table |