[One (M8) Q&A, Help & Troubleshooting] vladaxx:
There are other solutions to the wifi problems. These solutions did not help me but may help you...

First steps:

Restart the wifi AP.

Restart your phone.

Forget the wifi network (long tap on the wifi name, Forget network) and connect again.

Try WPS to connect to the wifi.

Rename the phone:

As seen here: http://android-revolution-hd.blogspot.cz/2014/02/how-to-fix-wi-fi-htc-one.html

Open Settings panel and click on the "Wi-Fi" tile

Tap on the "3 dots" menu in the upper right corner

From the list select "Wi-Fi Direct"

You will now see that your device is called "Android_ed2c". Tap on the "3 dots" menu in the upper right corner

From the list select "Rename device"

Replace the "Android_ed2c" with the "HTC One" text and hit "OK" button

Wipe cache partition:

go to settings> battery> deactivate the fast boot option.

turn the cell phone off.

with the cell phone off, press and hold the volume down key and the power key and hold them, you will have a white screen with a menu after that.

there, select the option that says "recovery" by pressing the volume down key and then press the power key to activate it.

after that is done, the cell phone will go off, after 30 seconds you will have an exclamation symbol on the screen inside a triangle, when you get that, press and hold the volume up key and while you hold it, press the power key one time.

after that, you will have another menu on the screen, please select the options that says "wipe cache partition" by pressing the volume down key and then press the power key to activate it.

you will see that the process is done at the bottom of the screen, then the option that says "reboot system now" will be highlighted.

press the power key to reboot the cell phone and the set the cell phone again.

Change the wifi optins:

Go to Settings, WiFi, then press on the option icon (three dots), then advanced.

Keep WiFi on during sleep: set to ALWAYS.

Wi-Fi frequency band: try one-by-one all three options.

Uncheck Wi-Fi optimization.

Uncheck auto-switch to mobile network.

Wifi Fixer:

Install Wifi Fixer.

Launch the app.

Try to connect to the wifi network.

WiFi Connection Manager:

Install WiFi Connection Manager.

Launch the app and press the three dots icon.

Select Fix Wi-Fi Problems.

Try one-by-one each available fix.

Disable/freeze the connection optimizer app:

Install an app that can freeze other apps (Titanium Backup, ROM Toolbox, System Tuner etc.).

Freeze your connection optimizer app (eg. Sprint Connections Optimizer).

Check the ROM and firmware version

Your ROM version must match to your firmware version.

You can check the firmware version on the bootloader screen:

Go to Settings, Power and disable Fast boot.

Power down your phone.

Press the volume-down and the power button. Hold them until the white bootloader screen appears.

Right after "OS" you will see your firmware version.

To find your ROM version:

Go to Settings, About, Software information.

Your ROM version is in the "ROM version" field.

If your ROM and firmware versions does not match you should install the newest system OTA update or flash the newest firmware using this guide. Then install the ROM that matches your firmware version.

Factory reset:

Backup all your data (I prefer Titanium Backup).

Go to Settings, and then tap Backup & reset.

Tap Reset phone.

Tap OK.

Install Titanium Backup.

Restore your apps and settings.